<template>
  <el-form :model="form" label-width="120px">
    <el-form-item label="轮播名称">
      <el-input v-model="form.name" />
    </el-form-item>
    <el-form-item label="广告链接">
      <el-input v-model="form.link" />
    </el-form-item>
    <el-form-item label="轮播图片">
      <ImgUpload v-model="form.url" />
    </el-form-item>
    <el-form-item label="是否显示">
      <el-switch v-model="form.show" />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">录入</el-button>
      <el-button>取消</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import ImgUpload from '../../components/imgUpload.vue'
import request from '../../untils/request'
export default {
  components: {
    ImgUpload
  },
  data() {
    return {
      form: {
        name: "100万的轮播",
        link: "https://cn.vuejs.org/guide/quick-start.html",
        url: "http://www.qfedu.com/2022/1130/1669787087805.jpg",
        show: true,
      }
    }
  },
  methods: {
    onSubmit() {
      console.log(this.form)
      request.post('/classes/banner', this.form)
    }
  }
}


</script>
